<script type="text/javascript">
    $.CurrentNavtab.find("#base_id").on("change", function() {
        var baseId = $(this).val();
        $.post("{:U('Admin/Block/getBaseBlock')}", {"baseId":baseId}, function(res) {
            var opt = "<option value='0'>请选择</option>";
            if(res["statusCode"] == 200) {
                var list = res["data"]["list"];
                for(var ix = 0; ix < list.length; ++ix) {
                    opt += "<option value='" + list[ix]["id"] + "'>" + list[ix]["sn"] + "</option>";
                }
            }
            $.CurrentNavtab.find("#block_id").html(opt);
        }, "json");
    });
    
    $.CurrentNavtab.find("#large_type").on("change", function() {
        var typeId = $(this).val();
        $.post("{:U('Admin/Type/getChildType')}", {"typeId":typeId}, function(res) {
            var opt = "<option value='0'>请选择</option>";
            if(res["statusCode"] == 200) {
                var list = res["data"]["list"];
                for(var ix = 0; ix < list.length; ++ix) {
                    opt += "<option value='" + list[ix]["id"] + "'>" + list[ix]["name"] + "</option>";
                }
            }
            $.CurrentNavtab.find("#small_type").html(opt);
        }, "json");
    });
    
    $.CurrentNavtab.find("#small_type").on("change", function() {
        var typeId = $(this).val();
        $.post("{:U('Admin/Tree/getTreeTypeAttr')}", {"typeId":typeId}, function(res) {
            var attr = "";
            if(res["statusCode"] == 200) {
                attr = res["data"]["attrStr"];
            }
            $.CurrentNavtab.find("#treeAttr").html(attr);
        }, "json");
    });
</script>
<style>
    #addMoreTreeForm table td.x85 {width:85px;text-align:right;}
    #addMoreTreeForm #treeAttr .attrRow {margin:5px 0;clear:both;}
</style>
<div class="bjui-pageContent">
    <form id="addMoreTreeForm" action="{:U('Admin/Tree/addMoreTree')}" data-toggle="validate" data-alertmsg="false">
        <table class="table table-condensed table-hover" width="100%">
            <tbody>
                <tr>
                    <td class="x85">
                        <label for="base_id" class="control-label x85">所属基地：</label>
                    </td>
                    <td>
                        <select name="base_id" id="base_id" class="form-control" style="width:200px;">
                            <option value="0">请选择</option>
                            <notempty name="base">
                                <foreach name="base" item="vo" key="k">
                                    <option value="{$vo.id}">{$vo.name}</option>
                                </foreach>
                            </notempty>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="block_id" class="control-label x85">所属地块：</label>
                    </td>
                    <td>
                        <select name="block_id" id="block_id" class="form-control" style="width:200px;">
                            <option value="0">请选择</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="large_type" class="control-label x85">苗木分类：</label>
                    </td>
                    <td>
                        <select name="large_type" id="large_type" class="form-control" style="width:200px;">
                            <option value="0">请选择</option>
                            <notempty name="largeType">
                                <foreach name="largeType" item="vo" key="k">
                                    <option value="{$vo.id}">{$vo.name}</option>
                                </foreach>
                            </notempty>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="small_type" class="control-label x85">苗木种类：</label>
                    </td>
                    <td>
                        <select name="small_type" id="small_type" class="form-control" style="width:200px;">
                            <option value="0">请选择</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="control-label x85">自有属性：</label>
                    </td>
                    <td>
                        <div id="treeAttr">
                            
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="status" class="control-label x85">状态：</label>
                    </td>
                    <td>
                        <select name="status" id="status" class="form-control" style="width:200px;">
                            <option value="0">请选择</option>
                            <notempty name="treeStatus">
                                <foreach name="treeStatus" item="vo" key="k">
                                    <option value="{$k}">{$vo}</option>
                                </foreach>
                            </notempty>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="startRow" class="control-label x85">起始行：</label>
                    </td>
                    <td>
                        <input type="text" name="startRow" id="startRow" value="" size="20">
                        <label for="endRow" class="control-label x85">终止行：</label>
                        <input type="text" name="endRow" id="endRow" value="" size="20">
                    </td>
                </tr>
                <tr>
                    <td>
                        <label for="startCol" class="control-label x85">起始列：</label>
                    </td>
                    <td>
                        <input type="text" name="startCol" id="startCol" value="" size="20">
                        <label for="endCol" class="control-label x85">终止列：</label>
                        <input type="text" name="endCol" id="endCol" value="" size="20">
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">取消</button></li>
        <li><button type="submit" class="btn-default" data-icon="save">添加</button></li>
    </ul>
</div>